<template>
	<view class="elevtor-info">
		<block v-if="!isElevatorId || isPage">
			<global-nav-bar @setHeight="setHeight" left-icon="back" title="电梯信息" :fixed="false"
				backgroundColor="#2C2C2C" color="#fff"></global-nav-bar>
			<view class="isElevatorId"></view>
		</block>
		<view class="tips" v-if="!info.isFull && closeFlag">
			<view class="tips_text">
				<image src="@/static/images/tips.png"></image>
				<text>设备信息未完善，请及时补充或纠正信息</text>
			</view>
			<image src="@/static/images/close2.png" class="close" @click="close"></image>
		</view>
		<view class="content" :style="isElevatorId || isPage ? 'padding-bottom: 120rpx;' : ''">
			<view class="content-header" v-if="!isElevatorId || isPage">
				<view class="content-header-title">
					{{ info.buildingName + info.elevatorAddress || null }}</view>
				<view class="content-header-address">{{
					info.buildingAddress || null
				}}</view>
			</view>
			<!-- 类型与位置 S -->
			<view class="content-items">
				<view class="tit_progress">
					<view class="tit_Left"><text class="tit_text"></text> 类型与位置</view>
					<view class="progress">
						<view class="progress_item">
							<text class="progress_empty">完</text>
							<text class="progress_full">完整度:</text>
						</view>
						<view class="progress_item2">
							<ai-progress ref="percentage" :percentage="integrityObj.lw" :isFiexd="true"
								:textInside="true" :strokeWidth="6" inBgColor="#DCF0FF" bgColor="#0091FF" />
						</view>
					</view>
				</view>
				<view class="form-content">
					<view class="form-item">
						<view class="left required">设备品种<text class="p_empty">完</text> </view>
						<view class="right" @click="openDriveMode">
							<view v-if="info.driveModeName">{{
								!info.driveModeName ? "" : info.driveModeName
							}}</view>
							<view v-else class="holder"><text>请选择设备品种</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="!info.driveModeName"></view>
					</view>
					<view class="form-item">
						<view class="left required">电梯年检类型<text class="p_empty" style="right:-14rpx">完</text></view>
						<view class="right" @click="openElevtorUse">
							<view v-if="info.useType || info.useType == 0">{{
								["年审梯", "非年审梯"][info.useType]
							}}</view>
							<view v-else class="holder"><text>请选择年审梯或者非年审梯</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="!info.useType && info.useType !== 0"></view>
					</view>
				</view>
			</view>
			<!-- E -->

			<!-- 电梯结构 S -->
			
			<view class="content-items">
				<view class="tit_progress">
					<view class="tit_Left"><text class="tit_text"></text> 电梯结构</view>
					<view class="progress">
						<view class="progress_item">
							<text class="progress_empty">完</text>
							<text class="progress_full">完整度:</text>
						</view>
						<view class="progress_item2">
							<ai-progress :percentage="integrityObj.jg" :isFiexd="true" :textInside="true"
								:strokeWidth="6" inBgColor="#DCF0FF" bgColor="#0091FF" />
						</view>
					</view>
				</view>
				<view class="form-content">
					<view class="form-item border-hide">
						<view class="left">电梯结构类型<text class="p_empty" style="right:-6rpx">完</text></view>
						<view class="right" @click="openStructure">
							<view v-if="structures.partTags.length==0">
								通用结构
							</view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="structures.partTags.length === 0"></view>
					</view>
					<view class="part-tags" v-if="structures.partTags && structures.partTags.length">
						<view class="part-tags-type" v-for="(item, index) in structures.partTags" :key="index">
							<view class="ptt-name">{{ item.name }}</view>
							<view class="ptt-list">
								<view class="tag" v-for="it in item.children" :key="it">{{ it }}</view>
							</view>
						</view>

					</view>
					<view class="relation-other" @click="toRelationOther" v-if="structures.partTags && structures.partTags.length">
						此结构应用到其他同类电梯({{bindNum}})
					</view>
				</view>
			</view>
			<!-- E -->

			<!-- 安装信息 S -->
			<view class="content-items">
				<view class="tit_progress">
					<view class="tit_Left"><text class="tit_text"></text> 安装信息</view>
					<view class="progress">
						<view class="progress_item">
							<text class="progress_empty">完</text>
							<text class="progress_full">完整度:</text>
						</view>
						<view class="progress_item2">
							<ai-progress :percentage="integrityObj.az" :isFiexd="true" :textInside="true"
								:strokeWidth="6" inBgColor="#DCF0FF" bgColor="#0091FF" />
						</view>
					</view>
				</view>
				<view class="form-content">
					<view class="form-item">
						<view class="left">启用时间<text class="p_empty" style="right:50rpx">完</text></view>
						<view class="right" @click="openDateSelect(1)">
							<view v-if="info.azCheckBeginDate">{{ formattedStartDate }}</view>
							<view v-else class="holder"><text>请选择启用时间</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="!info.azCheckBeginDate"></view>
					</view>
				</view>
			</view>
			<!--  E -->

			<!-- 维保信息 S -->
			<view class="content-items">
				<view class="tit_progress">
					<view class="tit_Left"><text class="tit_text"></text> 维保信息</view>
					<view class="progress">
						<view class="progress_item">
							<text class="progress_empty">完</text>
							<text class="progress_full">完整度:</text>
						</view>
						<view class="progress_item2">
							<ai-progress :percentage="integrityObj.wb" :isFiexd="true" :textInside="true"
								:strokeWidth="6" inBgColor="#DCF0FF" bgColor="#0091FF" />
						</view>
					</view>
				</view>
				<view class="form-content">
					<view class="form-item">
						<view class="left required">维保服务电话<text class="p_empty" style="right:-18rpx">完</text></view>
						<view class="right" @click="openPhoneSelect">
							<view>
								<text v-if="info.wbPhone">{{ wbPhone }}</text>
								<text v-else class="holder">请选择服务电话</text>
								<uni-icons color="#999" size="14" type="arrowright" />
							</view>
						</view>
						<view class="bg-empty" v-if="!info.wbPhone"></view>
					</view>

					<view class="imags-item">
						<view class="imags-item-head">
							<view class="left">服务电话贴纸<text class="p_empty" style="right:-52rpx">完</text></view>
							<view class="right" v-if="wbPhoneImg && info.wbPhoneImgDate && wbPhoneImg.length > 0">
								<text class="holder">
									{{ info.wbPhoneImgDate.split(" ")[0] }}更新
								</text>
							</view>
						</view>
						<view class="imags-item-content">
							<imageDragSort :isVideoShow="false" tips="上传图片" :max="imageMax" :showDel="false"
								:showUploadBtn="true" :showReset="false" @changeList="changeImgs($event, 'wbPhoneImg')"
								:list="wbPhoneImg" :disabled="false"></imageDragSort>
						</view>
					</view>

					<view class="imags-item" v-if="info.useType == 0">
						<view class="imags-item-head">
							<view class="left">维保标志附件<text class="p_empty" style="right:-52rpx">完</text></view>
							<view class="right" v-if="wbExtUrl && info.wbExtUrlDate && wbExtUrl.length > 0">
								<text class="holder">
									{{ info.wbExtUrlDate.split(" ")[0] }}更新
								</text>
							</view>
						</view>
						<view class="imags-item-content">
							<imageDragSort :isVideoShow="false" tips="上传图片" :max="imageMax" :showDel="false"
								:showUploadBtn="true" :showReset="false" @changeList="changeImgs($event, 'wbExtUrl')"
								:list="wbExtUrl" :disabled="false"></imageDragSort>
						</view>
					</view>
				</view>
			</view>
			<!--  E -->

			<!-- 保险信息S -->
			<view class="content-items">
				<view class="tit_progress">
					<view class="tit_Left"><text class="tit_text"></text> 保险信息</view>
					<view class="progress" v-if="info.useType == 0">
						<view class="progress_item">
							<text class="progress_empty">完</text>
							<text class="progress_full">完整度:</text>
						</view>
						<view class="progress_item2">
							<ai-progress :percentage="integrityObj.bx" :isFiexd="true" :textInside="true"
								:strokeWidth="6" inBgColor="#DCF0FF" bgColor="#0091FF" />
						</view>
					</view>
				</view>
				<view class="form-content">
					<view class="form-item">
						<view class="left">保险公司<text class="p_empty" style="right:56rpx" v-if="info.useType == 0">完</text></view>
						<view class="right" @click="showInsurance">
							<view v-if="info.bxCompanyId">{{ info.bxCompanyName }}</view>
							<view v-else class="holder"><text>请选择保险公司</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="!info.bxCompanyId"></view>
					</view>
					<view class="form-item">
						<view class="left">保险到期日期<text class="p_empty" style="right:0rpx" v-if="info.useType == 0">完</text></view>
						<view class="right" @click="openDateSelect(2)">
							<view v-if="info.bxCompanyEndDate">{{ formattedEndDate }}</view>
							<view v-else class="holder"><text>请选择保险到期日期</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="!info.bxCompanyEndDate"></view>
					</view>
					<view class="imags-item" v-if="info.useType == 0">
						<view class="imags-item-head">
							<view class="left">保险标志<text class="p_empty" style="right:-52rpx">完</text></view>
							<view class="right" v-if="info.bxExtUrl && info.bxExtUrlDate && info.bxExtUrl.length > 0">
								<text class="holder">
									{{ info.bxExtUrlDate.split(" ")[0] }}更新
								</text>
							</view>
						</view>
						<view class="imags-item-content">
							<imageDragSort :isVideoShow="false" tips="上传图片" :max="imageMax" :showDel="false"
								:showUploadBtn="true" :showReset="false" @changeList="changeImgs($event, 'bxExtUrl')"
								:list="info.bxExtUrl" :disabled="false"></imageDragSort>
						</view>
					</view>
				</view>
			</view>
			<!--  E -->

			<!-- 设备注册信息S -->
			<view class="content-items">
				<view class="tit_progress">
					<view class="tit_Left"><text class="tit_text"></text> 设备注册信息</view>
					<view class="progress" v-if="info.useType == 0">
						<view class="progress_item">
							<text class="progress_empty">完</text>
							<text class="progress_full">完整度:</text>
						</view>
						<view class="progress_item2">
							<ai-progress :percentage="integrityObj.sb" :isFiexd="true" :textInside="true"
								:strokeWidth="6" inBgColor="#DCF0FF" bgColor="#0091FF" />
						</view>
					</view>
				</view>
				<view class="form-content">
					<view class="form-item">
						<view class="left">
							设备代码<text class="p_empty" style="right:56rpx" v-if="info.useType == 0">完</text>
							<!--            <image src="@/static/images/tips.png" v-if="!info.privateNum || !info.privateNumIsFull"> -->
							<!--            </image> -->
						</view>
						<view class="right"><input :disabled="inputDisable" placeholder="请输入设备代码"
								v-model="info.privateNum" maxlength="20" placeholder-style="color:#ccc"
								@blur="()=>{integrityFunc(8)}" @input="changePrivateNum" /></view>
						<view class="bg-empty" v-if="!info.privateNum"></view>
					</view>
					<view class="form-item">
						<view class="left">
							登记证编码<text class="p_empty" style="right:28rpx" v-if="info.useType == 0">完</text>
							<!--            <image src="@/static/images/tips.png" v-if="!info.equipmentRegisterNumber"></image> -->
						</view>
						<view class="right"><input :disabled="inputDisable" type="text" placeholder="请输入登记证编码"
								placeholder-style="color:#ccc" @blur="()=>{integrityFunc(8)}"
								v-model="info.equipmentRegisterNumber" maxlength="20" />
						</view>
						<view class="bg-empty" v-if="!info.equipmentRegisterNumber"></view>
					</view>
					<view class="form-item">
						<view class="left">
							单位内编码<text class="p_empty" style="right:28rpx" v-if="info.useType == 0">完</text>
							<!--            <image src="@/static/images/tips.png" v-if="!info.registerNumber"></image> -->
						</view>
						<view class="right"><input :disabled="inputDisable" type="text" v-model="info.registerNumber"
								placeholder="请输入单位内编码" @blur="()=>{integrityFunc(8)}" placeholder-style="color:#ccc"
								maxlength="20" /></view>
						<view class="bg-empty" v-if="!info.registerNumber"></view>
					</view>
					<view class="form-item">
						<view class="left">
							检验机构
							<!--            <image src="@/static/images/tips.png" v-if="!info.certificationBody"></image> -->
						</view>
						<view class="right"><input :disabled="inputDisable" type="text" v-model="info.certificationBody"
								placeholder="请输入检验机构" placeholder-style="color:#ccc" maxlength="20" /></view>
						<!-- <view class="bg-empty" v-if="!info.certificationBody"></view> -->
					</view>
					<view class="form-item">
						<view class="left">
							登记机关
							<!--            <image src="@/static/images/tips.png" v-if="!info.registrationAuthority"></image> -->
						</view>
						<view class="right"><input :disabled="inputDisable" type="text"
								v-model="info.registrationAuthority" placeholder="请输入登记机关"
								placeholder-style="color:#ccc" maxlength="20" /></view>
						<!-- <view class="bg-empty" v-if="!info.registrationAuthority"></view> -->
					</view>

					<view class="imags-item">
						<view class="imags-item-head">
							<view class="left">使用证标志图片<text class="p_empty" style="right:-52rpx" v-if="info.useType == 0">完</text></view>
							<view class="right" v-if="fileListMark && info.certificateDate && fileListMark.length > 0
							">
								<text class="holder">
									{{ info.certificateDate.split(" ")[0] }}更新
								</text>
							</view>
						</view>
						<view class="imags-item-content">
							<imageDragSort :isVideoShow="false" tips="上传图片" :max="imageMax" :showDel="false"
								:showUploadBtn="true" :showReset="false"
								@changeList="changeImgs($event, 'fileListMark')" :list="fileListMark" :disabled="false">
							</imageDragSort>
						</view>
					</view>
				</view>

			</view>
			<!--  E -->

			<!-- 设备技术参数S -->
			<view class="content-items">
				<view class="tit_progress">
					<view class="tit_Left"><text class="tit_text"></text> 设备技术参数</view>
					<view class="progress">
						<view class="progress_item">
							<text class="progress_empty">完</text>
							<text class="progress_full">完整度:</text>
						</view>
						<view class="progress_item2">
							<ai-progress :percentage="integrityObj.sc" :isFiexd="true" :textInside="true"
								:strokeWidth="6" inBgColor="#DCF0FF" bgColor="#0091FF" />
						</view>
					</view>
				</view>
				<view class="form-content">
					<view class="form-item" v-if="typeKeys['driverMode']">
						<view class="left">
							<view>驱动方式<text class="p_empty" style="right:52rpx">完</text></view>
							<image src="@/static/images/tips.png" v-if="!fieldV.driverMode"></image>
						</view>
						<view class="right" @click="handleSelectShow('driverMode')">
							<view v-if="fieldV.driverMode && fieldV.driverMode !== null">{{
								selectItem.driverModeList.find(
									(v) => v.dictKey == fieldV.driverMode
								).name
							}}</view>
							<view v-else><text class="holder">请选择驱动方式</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="!fieldV.driverMode"></view>
					</view>
					<view class="form-item" v-if="typeKeys['ratedSpeed'] && fieldV.driverMode != '3'">
						<view class="left required">
							额定速度<text class="p_empty" style="right:48rpx">完</text>
							<!--            <image src="@/static/images/tips.png" v-if="!fieldV.ratedSpeed"></image> -->
						</view>
						<view class="right" >
							<input type="number" :disabled="inputDisable" placeholder="请输入额定速度"
								placeholder-style="color:#ccc;" v-model="fieldV.ratedSpeed"
								@input="(e) => getSpeed(e, 'speed')" @blur="()=>{integrityFunc(3)}" />
							<text class="unit" v-if="fieldV.ratedSpeed">m/s</text>
							<!--            <view v-else style="width: 100%; text-align: right"><text -->
							<!--                style="color: #ccc; width: fit-content">请输入额定速度</text></view> -->
						</view>
						<view class="bg-empty" v-if="!fieldV.ratedSpeed"></view>
					</view>

					<view class="form-item" v-if="(typeKeys['ratedSpeedUp'] && !typeKeys['driverMode']) ||
						(fieldV.driverMode == '3' &&
							typeKeys['driverMode'] &&
							typeKeys['ratedSpeedUp'])
					">
						<view class="left required">
							额定上行速度<text class="p_empty" style="right:-8rpx">完</text>
							<!--            <image src="@/static/images/tips.png" v-if="!fieldV.ratedSpeedUp"></image> -->
						</view>
						<view class="right">
							<input type="number" :disabled="inputDisable" placeholder="请输入额定上行速度"
								placeholder-style="color:#ccc;" v-model="fieldV.ratedSpeedUp"
								@input="(e) => getSpeed(e, 'upSpeed')" @blur="()=>{integrityFunc(3)}" />
							<text class="unit" v-if="fieldV.ratedSpeedUp">m/s</text>
							<!--            <view v-else style="width: 100%; text-align: right"><text -->
							<!--                style="color: #ccc; width: fit-content;white-space: nowrap;">请输入额定上行速度</text></view> -->
						</view>
						<view class="bg-empty" v-if="!fieldV.ratedSpeedUp"></view>
					</view>
					<view class="form-item" v-if="(typeKeys['ratedSpeedDown'] && !typeKeys['driverMode']) ||
						(fieldV.driverMode == '3' &&
							typeKeys['driverMode'] &&
							typeKeys['ratedSpeedDown'])
					">
						<view class="left required">
							额定下行速度<text class="p_empty" style="right:-8rpx">完</text>
							<!--            <image src="@/static/images/tips.png" v-if="!fieldV.ratedSpeedDown"></image> -->
						</view>
						<view class="right">
							<input type="number" :disabled="inputDisable" placeholder="请输入额定下行速度"
								placeholder-style="color:#ccc;" v-model="fieldV.ratedSpeedDown"
								@input="(e) => getSpeed(e, 'downSpeed')" @blur="()=>{integrityFunc(3)}" />
							<text class="unit" v-if="fieldV.ratedSpeedDown">m/s</text>
							<!--            <view v-else style="width: 100%; text-align: right"><text -->
							<!--                style="color: #ccc; width: fit-content;white-space: nowrap;">请输入额定下行速度</text></view> -->
						</view>
						<view class="bg-empty" v-if="!fieldV.ratedSpeedDown"></view>
					</view>
					<block v-for="item in formList" :key="item.key">
						<view class="form-item" v-if="typeKeys[item.key]">
							<view class="left required">
								{{ item.name }}<text class="p_empty" style="right:0rpx">完</text>
								<!--              <image src="@/static/images/tips.png" v-if="!fieldV[item.key]"></image> -->
							</view>
							<view class="right">
								<input type="number" placeholder-style="color:#ccc" :placeholder="'请输入' + item.name"
									:disabled="inputDisable" v-model="fieldV[item.key]" maxlength="20"
									@blur="()=>{integrityFunc(3)}" />
								<text class="unit" v-if="fieldV[item.key]">{{ item.unit }}</text>
								<!--              <view v-else style="width: 100%; text-align: right"><text -->
								<!--                  style="color: #ccc; width: fit-content; white-space: nowrap;">请输入{{item.name}}</text></view> -->
							</view>
							<view class="bg-empty" v-if="!typeKeys[item.key]"></view>
						</view>
					</block>
					<view class="form-item" v-if="typeKeys['ratedWeight']">
						<view class="left required">
							额定载重量<text class="p_empty" style="right:20rpx">完</text>
							<!--            <image src="@/static/images/tips.png" v-if="!fieldV.ratedWeight"></image> -->
						</view>
						<view class="right">
							<input type="number" :disabled="inputDisable" placeholder="请输入额定载重量"
								placeholder-style="color:#ccc;" v-model="fieldV.ratedWeight" maxlength="4"
								@input="resetPower" @blur="()=>{integrityFunc(3)}" />
							<text class="unit" v-if="fieldV.ratedWeight">kg</text>
							<!--            <view v-else style="width: 100%; text-align: right"><text -->
							<!--                style="color: #ccc; width: fit-content">请输入额定重量</text></view> -->
						</view>
						<view class="bg-empty" v-if="!fieldV.ratedWeight"></view>
					</view>
					<view class="form-item" v-if="(typeKeys['oilCylinderNum'] && !typeKeys['driverMode']) ||
						(fieldV.driverMode == '3' &&
							typeKeys['driverMode'] &&
							typeKeys['oilCylinderNum'])
					">
						<view class="left required">
							油缸数量<text class="p_empty" style="right:48rpx">完</text>
							<!--            <image src="@/static/images/tips.png" v-if="!fieldV.oilCylinderNum"></image> -->
						</view>
						<view class="right">
							<uni-number-box class="number-box" :min="1" :max="100000" v-model="fieldV.oilCylinderNum"
								@blur="()=>integrityFunc(3)"></uni-number-box>
							<!--            <view v-else style="width: 100%; text-align: right"><text -->
							<!--                style="color: #ccc; width: fit-content">请输入油缸数量</text></view> -->
						</view>
						<view class="bg-empty" v-if="!fieldV.oilCylinderNum"></view>
					</view>
					<view class="form-item" v-if="(typeKeys['jackingForm'] && !typeKeys['driverMode']) ||
						(fieldV.driverMode == '3' &&
							typeKeys['driverMode'] &&
							typeKeys['jackingForm'])
					">
						<view class="left">
							<view class="required">顶升形式<text class="p_empty" style="right:48rpx">完</text></view>
							<!--            <image src="@/static/images/tips.png" v-if="!fieldV.jackingForm"></image> -->
						</view>
						<view class="right" @click="handleSelectShow('jackingForm')">
							<view v-if="fieldV.jackingForm && fieldV.jackingForm !== null">{{
								selectItem.jackingFormList.find(
									(v) => v.dictKey == fieldV.jackingForm
								).name
							}}</view>
							<view v-else><text class="holder">请选择顶升形式</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="!fieldV.jackingForm"></view>
					</view>
					<view class="form-item" v-if="typeKeys['controlMode']">
						<view class="left">
							<view class="required">控制方式<text class="p_empty" style="right:48rpx">完</text></view>
							<!--            <image src="@/static/images/tips.png" v-if="!fieldV.controlMode"></image> -->
						</view>
						<view class="right" @click="handleSelectShow('controlMode')">
							<view v-if="fieldV.controlMode && fieldV.controlMode !== null">{{
								selectItem.controlModeList.find(
									(v) => v.dictKey == fieldV.controlMode
								).name
							}}</view>
							<view v-else><text class="holder">请选择控制方式</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="!fieldV.controlMode"></view>
					</view>
					<block v-for="item in floorFormGroup" :key="item.prop">
						<view class="form-item" @click="showFloorSelect(item)" v-if="typeKeys[item.prop]">
							<view class="left left-col">
								<view>{{ item.label }} <text class="p_empty" style="right:140rpx">完</text></view>
								<view class="desc">{{ item.labelMsg }}</view>
							</view>
							<view class="right">
								<view v-if="item.selectValue.length > 0">
									{{ item.selectValue.join() }}</view>
								<view v-else><text class="holder">{{ item.selectPlaceholder }}</text></view>
								<uni-icons color="#999" size="14" type="arrowright" />
							</view>
							<view class="bg-empty" style="height: 80rpx;top:24rpx" v-if="item.selectValue.length === 0">
							</view>
						</view>
						<view class="form-item" v-if="typeKeys[item.prop]">
							<view class="left left-col">
								<view class="required">{{ item.inputLabel }}<text class="p_empty"
										:style="!item.inpLabelMsg ? 'right:76rpx' : 'right:100rpx'">完</text>
									<!--                <image src="@/static/images/tips.png" v-if="!fieldV[item.prop]"></image> -->
								</view>
								<view class="desc" v-if="item.inpLabelMsg">{{
									item.inpLabelMsg
								}}</view>
							</view>
							<view class="right">
								<input type="number" :placeholder="item.inputPlaceholder" placeholder-style="color:#ccc"
									:disabled="inputDisable" v-model="fieldV[item.prop]" maxlength="4"
									@blur="()=>{integrityFunc(3)}" />
							</view>
							<view class="bg-empty" v-if="!fieldV[item.prop]"></view>
						</view>
					</block>
					<view class="form-item" v-if="typeKeys['antiExplosionMark']">
						<view class="left required">
							整机防爆标志<text class="p_empty" style="right:10rpx">完</text>
							<!--            <image src="@/static/images/tips.png" v-if="!fieldV.antiExplosionMark"></image> -->
						</view>
						<view class="right"><input :disabled="inputDisable" type="text"
								v-model="fieldV.antiExplosionMark" placeholder="请输入，如：ExdeibmIIBT4"
								placeholder-style="color:#ccc" @blur="()=>{integrityFunc(3)}" />
						</view>
						<view class="bg-empty" v-if="!fieldV.antiExplosionMark"></view>
					</view>
					<view class="form-item" v-if="typeKeys['antiExplosionMark']">
						<view class="left required">
							<view>区域防爆等级<text class="p_empty" style="right:10rpx">完</text></view>
							<!--            <image src="@/static/images/tips.png" v-if="!fieldV.antiExplosionLevel"></image> -->
						</view>
						<view class="right" @click="handleSelectShow('antiExplosionLevel')">
							<view v-if="fieldV.antiExplosionLevel && fieldV.antiExplosionLevel !== null
							">{{
								selectItem.antiExplosionLevelList.find(
									(v) => v.id == fieldV.antiExplosionLevel
								).name
							}}</view>
							<view v-else><text class="holder">请选择区域防爆等级</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="!fieldV.antiExplosionLevel"></view>
					</view>
					<!--
          <view class="form-item noBorder">
            <view class="left">
              提升高度
              <image src="@/static/images/tips.png" v-if="!info.hoistHeight"></image>
            </view>
            <view class="right"><input :disabled="inputDisable" type="number" v-model="info.hoistHeight"
                placeholder="请输入提升高度" placeholder-style="color:#ccc" maxlength="20" /></view>
          </view>
           -->
				</view>

			</view>
			<!--  E -->

			<!-- 出厂信息S -->
			<view class="content-items">
				<view class="tit_progress">
					<view class="tit_Left"><text class="tit_text"></text> 出厂信息</view>
					<view class="progress">
						<view class="progress_item">
							<text class="progress_empty">完</text>
							<text class="progress_full">完整度:</text>
						</view>
						<view class="progress_item2">
							<ai-progress :percentage="integrityObj.cc" :isFiexd="true" :textInside="true"
								:strokeWidth="6" inBgColor="#DCF0FF" bgColor="#0091FF" />
						</view>
					</view>
				</view>
				<view class="form-content">
					<view class="form-item">
						<view class="left">
							<view class="required">品牌<text class="p_empty" style="right:100rpx">完</text></view>
							<!--            <image src="@/static/images/tips.png" v-if="!info.brandName"></image> -->
						</view>
						<view class="right" @click="showBrand">
							<view v-if="info.brandName && info.brandName !== null">{{
								info.brandName
							}}</view>
							<view v-else><text class="holder">请选择</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<view class="bg-empty" v-if="!info.brandName"></view>
					</view>

					<view class="form-item">
						<view class="left">
							<view>型号</view>
							<!--            <image src="@/static/images/tips.png" v-if="!info.brandVName"></image> -->
						</view>
						<view class="right" @click="getBrandversionList">
							<view v-if="info.brandVName && info.brandVName !== null">{{
								info.brandVName
							}}</view>
							<view v-else><text class="holder">请选择</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
					</view>

					<view class="form-item">
						<view class="left">
							<view>系列</view>
							<!--            <image src="@/static/images/tips.png" v-if="!info.brandVSkuName"></image> -->
						</view>
						<view class="right" @click="getBrandversionskuList">
							<view v-if="info.brandVSkuName && info.brandVSkuName !== null">{{
								info.brandVSkuName
							}}</view>
							<view v-else><text class="holder">请选择</text></view>
							<uni-icons color="#999" size="14" type="arrowright" />
						</view>
						<!-- <view class="bg-empty" v-if="!info.brandVSkuName"></view> -->
					</view>

					<view class="form-item">
						<view class="left">
							生产工号
							<!--            <image src="@/static/images/tips.png" v-if="!info.manufactureNo"></image> -->
						</view>
						<view class="right"><input :disabled="inputDisable" type="text" v-model="info.manufactureNo"
								placeholder="请输入生产工号" placeholder-style="color:#ccc" maxlength="20" /></view>
					</view>

					<view class="form-item">
						<view class="left">
							出厂编号
							<!--            <image src="@/static/images/tips.png" v-if="!info.factoryNumber"></image> -->
						</view>
						<view class="right"><input :disabled="inputDisable" type="text" v-model="info.factoryNumber"
								placeholder-style="color:#ccc" placeholder="请输入出厂编号" /></view>
					</view>
					<view class="form-item">
						<view class="left">
							合格证号
							<!--            <image src="@/static/images/tips.png" v-if="!info.certNo"></image> -->
						</view>
						<view class="right"><input :disabled="inputDisable" type="text" v-model="info.certNo"
								placeholder="请输入合格证号" placeholder-style="color:#ccc" maxlength="20" /></view>
					</view>

					<picker mode="date" :end="startDate" :value="info.madeDate" fields="day"
						@change="changeMadeDate($event, 'madeDate')">
						<view class="form-item">
							<view class="left">
								制造日期
								<!--              <image src="@/static/images/tips.png" v-if="!info.madeDate"></image> -->
							</view>
							<view class="right" v-if="info.madeDate">
								{{ info.madeDate.split(" ")[0] }}</view>
							<view v-else><text class="holder">请选择</text></view>
						</view>
					</picker>

					<picker mode="date" :end="startDate" :value="info.factoryDate" fields="day"
						@change="changeMadeDate($event, 'factoryDate')">
						<view class="form-item">
							<view class="left">
								出厂日期
								<!--              <image src="@/static/images/tips.png" v-if="!info.factoryDate"></image> -->
							</view>
							<view class="right" v-if="info.factoryDate">
								{{ info.factoryDate.split(" ")[0] }}</view>
							<view v-else><text class="holder">请选择</text></view>
						</view>
					</picker>

					<view class="imags-item">
						<view class="imags-item-head">
							<view class="left">电梯铭牌附件</view>
							<view class="right" v-if="nameAttachmentList &&
								info.nameAttachmentTime &&
								nameAttachmentList.length > 0
							">
								<text class="holder">
									{{ info.nameAttachmentTime.split(" ")[0] }}更新
								</text>
							</view>
						</view>
						<view class="imags-item-content">
							<imageDragSort :isVideoShow="false" tips="上传图片" :max="imageMax" :showDel="false"
								:showUploadBtn="true" :showReset="false" @changeList="changeAttachmentList"
								:list="nameAttachmentList" :disabled="false"></imageDragSort>
						</view>
					</view>
				</view>

			</view>
			<!--  E -->

			<!-- <view class="form-content" style="margin-top: 28rpx">
        <view class="form-item">
          <view class="left">
            年检日期
            <image
              src="@/static/images/tips.png"
              v-if="!info.elevatorAudit"
            ></image>
          </view>
          <view class="right"
            ><input
              type="text"
              :disabled="true"
              v-model="info.elevatorAudit"
              maxlength="20"
          /></view>
        </view>
      </view> -->

			<!-- 快速识别代码S -->
			<view class="content-items">
				<view class="tit_progress">
					<view class="tit_Left"><text class="tit_text"></text> 快速识别代码</view>
					<view class="progress">
						<view class="progress_item">
							<text class="progress_empty">完</text>
							<text class="progress_full">完整度:</text>
						</view>
						<view class="progress_item2">
							<ai-progress :percentage="integrityObj.pt" :isFiexd="true" :textInside="true"
								:strokeWidth="6" inBgColor="#DCF0FF" bgColor="#0091FF" />
						</view>
					</view>
				</view>
				<view class="form-content">
					<view class="form-item">
						<view class="left onlynum"> 唯一快速识别代码 </view>
						<view class="right">
							<view>{{ info.elevatorNum }}</view>
						</view>
					</view>

					<view class="imags-item">
						<view class="imags-item-head">
							<view class="left">快速识别代码贴纸<text class="p_empty" style="right:-38rpx">完</text></view>
							<view class="right" v-if="info.elevatorNumImg &&
								info.elevatorNumImgDate &&
								info.elevatorNumImg.length > 0
							">
								<text class="holder">
									{{ info.elevatorNumImgDate.split(" ")[0] }}更新
								</text>
							</view>
						</view>
						<view class="imags-item-content">
							<imageDragSort :isVideoShow="false" tips="上传图片" :max="imageMax" :showDel="false"
								:showUploadBtn="true" :showReset="false"
								@changeList="changeImgs($event, 'elevatorNumImg')" :list="info.elevatorNumImg"
								:disabled="false"></imageDragSort>
						</view>
					</view>
				</view>
			</view>
			<!--  E -->

			<!-- 使用信息S -->
			<view class="content-items">
				<view class="tit_progress">
					<view class="tit_Left"><text class="tit_text"></text> 使用信息</view>
					<view class="progress">
						<view class="progress_item">
							<text class="progress_empty">完</text>
							<text class="progress_full">完整度:</text>
						</view>
						<view class="progress_item2">
							<ai-progress :percentage="integrityObj.sy" :isFiexd="true" :textInside="true"
								:strokeWidth="6" inBgColor="#DCF0FF" bgColor="#0091FF" />
						</view>
					</view>
				</view>
				<view class="form-content">
					<view class="form-item noBorder">
						<view class="left">
							安全管理员<text class="p_empty" style="right:30rpx">完</text>
							<!--            <image src="@/static/images/tips.png" v-if="!info.securityGuardName"></image> -->
						</view>
						<view class="right"><input :disabled="inputDisable" type="text" v-model="info.securityGuardName"
								placeholder-style="color:#ccc" @blur="()=>integrityFunc(5)" placeholder="请输入安全管理员" /></view>
						<view class="bg-empty" v-if="!info.securityGuardName"></view>
					</view>
				</view>

			</view>
			<!--  E -->

			<view class="save" @click="handleSave">
				<view :style="disabled ? 'background:#bbc2c7' : ''">保存</view>
			</view>
		</view>
		<!-- 保险弹出框 -->
		<uni-popup ref="popupIn" type="bottom" @activeInput="activeInput">
			<select-picker :list="[insuranceList]" keyVal="name" @close="handleCloseIn" :mask-click="false"
				:active="inActive">
			</select-picker>
		</uni-popup>

		<!-- 品牌弹出框 -->
		<uni-popup ref="popup" type="bottom" @activeInput="activeInput">
			<select-picker :list="[brandList]" @close="handleClose" :mask-click="false" :active="brandActive">
			</select-picker>
		</uni-popup>
		<!-- 型号弹出框 -->
		<uni-popup ref="brandversions" type="bottom" @activeInput="activeInput">
			<select-picker keyVal="name" :list="[brandversions]" @close="handleBvClose" :mask-click="false">
			</select-picker>
		</uni-popup>

		<!-- 系列弹出框 -->
		<uni-popup ref="brandVSkus" type="bottom" @activeInput="activeInput">
			<select-picker keyVal="name" :list="[brandVSkus]" @close="brandVSkuClose" :mask-click="false">
			</select-picker>
		</uni-popup>
		<!-- 层站门弹出框 -->
		<uni-popup ref="popup2" type="bottom" @activeInput="activeInput">
			<select-picker :list="[doorList, doorList, doorList]" :title="['层', '站', '门']" @close="handleCloseDoor"
				:mask-click="false" :active="floorActive" :type="2"></select-picker>
		</uni-popup>
		<!-- 驱动方式弹出框 -->
		<uni-popup ref="popup3" type="bottom" @activeInput="activeInput">
			<select-picker :list="[driveModeList]" @close="handleCloseDriveMode" :mask-click="false"
				:active="DriveActive" :type="3"></select-picker>
		</uni-popup>
		<!-- 电梯年检类型弹出框 -->
		<uni-popup ref="elevtorUse" type="bottom" @activeInput="activeInput">
			<select-picker :list="[typeSeleArrs]" @close="handleCloseElevtorUse" :mask-click="false" :type="3"
				:active="elevtorUseActive"></select-picker>
		</uni-popup>
		<!-- 启用时间弹出框 -->
		<uni-popup ref="startTime" type="bottom" @activeInput="activeInput" @maskClick="maskClick">
			<select-picker :list="allData" :timeType="timeType" :dateType="2" @close="handleCloseDate" :mask-click="false" :type="3"
				:active="startTimeActive" @bindChange="bindChange"></select-picker>
		</uni-popup>

		<!-- 服务电话弹出框 -->
		<uni-popup ref="phoneNums" type="bottom" @activeInput="activeInput" @maskClick="maskClick">
			<view>
				<select-picker title="维保服务电话" :list="[phoneNums]" keyVal="label" @close="phoneNumsClose"
					:mask-click="false" :type="1" :active="phoneAct" @bindChange="phoneNumsChange"></select-picker>
			</view>
		</uni-popup>
		<!-- 选择弹出框 -->
		<uni-popup ref="selectRef" type="bottom" @activeInput="activeInput">
			<select-picker keyVal="name" :type="1" :title="selectItem.title" :list="[selectItem.list]"
				@close="handleSelectClose" :mask-click="false" :active="selectItem.active">
			</select-picker>
		</uni-popup>
		<!-- 层站门弹出框 -->
		<uni-popup ref="floorRef" type="bottom" @activeInput="activeInput">
			<select-check-door v-if="floorItem.prop === 'door'" :title="floorItem.title" :active="floorItem.selectValue"
				:list="floorNumsOptions" @close="handleFloorClose">
			</select-check-door>
			<select-check v-else :title="floorItem.label" :active="floorItem.selectValue" :list="floorNumsOptions"
				@close="handleFloorClose">
			</select-check>
		</uni-popup>
		<elevatorSelecter ref="elevatorSelecter" @success="getBindElevatorNum"></elevatorSelecter>
		<previewMedia ref="previewMedia"></previewMedia>
		<structureSelecter ref="structureSelecter" @success="getStructures(),getBindElevatorNum()"></structureSelecter>
		<previewMedia ref="previewMedia"></previewMedia>
	</view>
</template>

<script>
import dayjs from 'dayjs';
import uniPopup from '@/components/uni-popup/uni-popup';
import SelectPicker from './components/select-piker.vue';
import SelectCheck from './components/select-check.vue';
import SelectCheckDoor from './components/select-check-door.vue';
import GlobalNavBar from '@/components/uni-nav-bar/global-nav-bar';
import imageDragSort from '@/components/image-drag-sort/img-and-video.vue';
import aiprogress from '@/components/ai-progress/ai-progress.vue'; 
import structureSelecter from './components/structure-selecter.vue';
import elevatorSelecter from './components/elevator-selecter.vue';
import optData from './options.json';
import {
	elevtorDetail,
	getBrand,
	getDriveModeSelect as getDriveMode,
	update,
	getElevatorPhones,
	getBrandversionList,
	getBrandversionskuList,
	getFieldSelect, getStructures,getBindElevatorNum
} from '@/apis/elevator.js';
import {
	insurance
} from '@/apis/barrierSearch.js';

// import { location } from '@/apis/maintains.js';
// import duNav from '@/components/nav-box/nav-box.vue';
export default {
	components: {
		uniPopup,
		SelectPicker,
		SelectCheck,
		SelectCheckDoor,
		GlobalNavBar,
		imageDragSort,
		aiprogress,
		structureSelecter,
		elevatorSelecter
		// duNav
	},
	data() {
		return {
			mheight: 0,
			info: {
				privateNumIsFull: true,
				controlMode: '',
				controlModeName: '',
				driveModeName: '',
				antiExplosionLevelName: '',
				// 保险信息
				bxExtUrl: [],
				bxExtUrlDate: '',
				bxCompanyId: '',
				bxCompanyEndDate: '',
				bxCompanyName: '',
				azCheckBeginDate:''
			},
			driveMode: [],
			disabled: false,
			elevatorUseType: '',
			closeFlag: true,
			doorList: this.getArr(2, 50),
			monthList: this.getArr(1, 12),
			yearList: this.getYears(),
			startDate: dayjs().format('YYYY-MM-DD'),
			index: 0,
			elevatorId: '',
			brandList: [],
			floorActive: [0, 0, 0],
			brandActive: [0],
			inActive: [0],
			DriveActive: [0],
			elevtorUseActive: [0],
			startTimeActive: [0, 0],
			locationList: [],
			driveModeList: [],
			useType: '',
			startTimeStr: '',
			inputDisable: false,
			startTimeList: [],
			formList: [
				{
					name: '名义速度',
					key: 'nominalSpeed',
					unit: 'm/s',
				},

				{
					name: '名义宽度',
					key: 'nominalWidth',
					unit: 'mm',
				},
				{
					name: '倾斜角度',
					key: 'inclineAngle',
					unit: '度',
				},
				{
					name: '输送能力',
					key: 'transportCapacity',
					unit: 'P/h',
				},
				{
					name: '提升高度',
					key: 'promoteHeight',
					unit: 'm',
				},
				{
					name: '使用区段长度',
					key: 'zoneLength',
					unit: 'm',
				},
			],
			list: [
				{
					name: '品牌',
					key: 'brandName',
					disabled: true,
				},

				{
					name: '设备代码',
					key: 'privateNum',
				},
				{
					name: '设备品种',
					key: 'driveModeName',
					disabled: true,
				},
				{
					name: '额定载重量',
					key: 'supportingPower',
					unit: 'kg',
				},
				{
					name: '额定速度',
					key: 'speed',
					unit: 'm/s',
				},
				{
					name: '层站门',
					key: 'code',
					disabled: true,
				},
				{
					name: '单位内编码',
					key: 'registerNumber',
				},
				{
					name: '登记证编码',
					key: 'equipmentRegisterNumber',
				},
				{
					name: '',
					key: '',
				},
			],
			// 维保服务电话
			phoneNums: [],
			phoneAct: 0,
			// 电梯铭牌附件
			nameAttachmentList: [],
			// 使用证标志图片
			fileListMark: [],
			// 型号列表
			brandversions: [],
			// 系列
			brandVSkus: [],
			// 控制方式选项
			controlModeList: [],
			floorNumsList: [],
			floorNumsOptions: [],
			imageMax: 1,
			fieldV: {
				driverMode: '',
				ratedSpeedUp: '',
				ratedSpeedDown: '',

				oilCylinderNum: '',
				jackingForm: '',

				nominalSpeed: '',
				nominalWidth: '',
				inclineAngle: '',
				transportCapacity: '',
				zoneLength: '',

				promoteHeight: '',

				ratedSpeed: '',
				ratedWeight: '',
				tier: '',
				stand: '',
				door: '',
				controlMode: '',
			},
			// 层站门信息
			floorFormGroup: [
				{
					label: '层',
					inputLabel: '层数',
					inpLabelMsg: '(物理层编号)',
					labelMsg: '(物理层数)',
					inputPlaceholder: '请输入层数',
					selectPlaceholder: '选填电梯层数',
					prop: 'tier',
					selectKey: 'floorTier',
					selectValue: [],
					floorNums: [],
					checkAll: false,
				},
				{
					label: '站',
					inputLabel: '站数',
					labelMsg: '(停靠站数)',
					inpLabelMsg: '(停靠站层编号)',
					inputPlaceholder: '请输入站数',
					selectPlaceholder: '选填本梯站所在楼层编号',
					prop: 'stand',
					selectKey: 'floorPlatforms',
					selectValue: [],
					floorNums: [],
					checkAll: false,
				},
				{
					label: '门',
					inputLabel: '层门数',
					inpLabelMsg: '',
					labelMsg: '(层门编号)',
					inputPlaceholder: '请输入门数',
					selectPlaceholder: '选填电梯层门数',
					prop: 'door',
					selectKey: 'floorDoors',
					selectValue: [],
					floorNums: [],
					checkAllBefore: false,
					checkAllAfter: false,
				},
			],
			floorItem: {
				prop: 'tier',
				label: '',
				selectValue: [],
			},
			elevatorUseTypeListMap: null,
			selectItem: {
				title: '',
				key: '',
				list: [],
				active: [0],
				controlModeList: [],
				jackingFormList: [],
				driverModeList: [],
				antiExplosionLevelList: [],
				versionList: [],
				skuList: [],
				// 备用单位列表
				buildinguserList: [],
			},
			integrityObj: {
				lw: 0,// 类型与位置
				wb: 0,// 维保信息
				sc: 0,// 设备技术参数
				cc: 0,// 出厂信息
				sy: 0,// 使用信息
				az: 0,// 安装信息
				pt: 0,// 梯无忧平台信息
				sb: 0,// 设备注册信息
				bx: 0,// 保险信息
				jg: 0,// 电梯结构类型
			},
			insuranceList: [],
			timeType: 0,
			// 结构详情
			structures: {
				partTags: []
			},
			bindNum:0,
			floorDoors:[],// 层门信息
			ymdData: [],
			dayList:[],
			allData:[],
			typeSeleArrs: []
		};
	},
	props: {
		isElevatorId: {
			type: String,
			default: '',
		},
		isPage: {
			type: Boolean,
			default: false,
		},
	},
	watch:{	},

	computed: {
		showTips() {
			const temp = [];
			let flag = true;
			this.list.map((item) => {
				if (!this.info[item.key]) {
					temp.push(item);
				}
			});
			flag = temp.length ? true : false;
			return flag;
		},
		wbPhoneImg() {
			// this.info.wbPhoneImg?JSON.parse(this.info.wbPhoneImg):[]
			return this.info.wbPhoneImg || [];
		},
		wbExtUrl() {
			return this.info.wbExtUrl || [];
		},
		// fileListMark() {
		//   return this.info.fileListMark || []
		// },
		wbPhone() {
			if (this.info.wbPhone) {
				let idx = this.phoneNums.findIndex((it) => {
					return it.phone == this.info.wbPhone;
				});
				if (idx != -1) {
					return this.phoneNums[idx].label;
				} else {
					return this.info.wbPhone;
				}
			} else {
				return '';
			}
		},
		// 当前设备品种
		typeKeys() {
			if (this.info.elevatorUseType && this.elevatorUseTypeListMap) {
				let fieldTemplate =
					(this.elevatorUseTypeListMap[this.info.elevatorUseType + ''] || {})
						.fieldTemplate || [];
				let map = {};
				for (let i = 0; i < fieldTemplate.length; i++) {
					map[fieldTemplate[i].k] = fieldTemplate[i];
				}
				return map;
			} else {
				return {};
			}
		},
		formattedStartDate() {
			return this.info.azCheckBeginDate ? this.getMadeDate(this.info.azCheckBeginDate,true) : '--';
		},
		formattedEndDate() {
			return this.info.bxCompanyEndDate ? this.getMadeDate(this.info.bxCompanyEndDate,true) : '--';
		},
	},
	onLoad(opt) {
		console.log(opt.id);
		if (!this.isElevatorId) {
			this.elevatorId = opt.id;
			this.fetchBrand();
			this.getInfo();
		}
	},
	created() {
		// this.getLocation();
		
		this.getYears();
	},
	mounted() {
		if (this.isElevatorId) {
			this.elevatorId = this.isElevatorId;
			this.fetchBrand();
			this.getInfo();
			this.getElevatorPhones();
			this.getElevatorInsuranceList();
			this.getStructures();
			this.getBindElevatorNum();
		}
		uni.$on('buildingEditSuccess', async (res) => {
			console.log(res, 'buildingEditSuccess');
			try {
				// if(res.buildingId !== this.info.buildingId){
				//   return
				// }
				if (!this.elevatorId || this.elevatorId === '0') {
					return;
				}
				uni.showLoading({
					title: '加载中',
				});
				const res = await elevtorDetail({
					elevatorId: this.elevatorId,
				});
				uni.hideLoading();
				console.log(res, 'buildingEditSuccess-data');
				if (res.code === 200) {
					this.info.floorTier = res.data.floorTier || [];
					this.info.floorPlatforms = res.data.floorPlatforms || [];
					this.info.floorDoors = res.data.floorDoors || [];
					this.initFloorData(res);
				} else {
					uni.showToast('请求失败');
				}
			} catch (e) {
				console.log(e, 'error-buildingEditSuccess');
			}
		});
	},
	beforeDestroy() {
		uni.$off('buildingEditSuccess');
	},
	onUnload() {
		uni.$off('buildingEditSuccess');
	},
	methods: {
		getBindElevatorNum() {
			getBindElevatorNum({
				elevatorId: this.elevatorId
			}).then(res=>{
				this.bindNum = res.data || 0;
			});
		},
		// 打开关联应用到其他电梯弹窗
		toRelationOther() {
			this.$refs.elevatorSelecter.init({
				elevatorId: this.elevatorId ,
				bindNum:this.bindNum,
				structureTemplateId:this.structures.structureTemplateId
			});
		},
		// 打开结构编辑弹窗
		openStructure() {
			this.$refs.structureSelecter.init({
				elevatorId: this.elevatorId,
				...this.structures
			});
		},
		// 获取电梯部件模板
		getStructures() {
			getStructures({
				elevatorId: this.elevatorId
			}).then(res => {
				if (!res.data) {
					return;
				}
				console.log('getStructures', res);
				let names = (res.data.categoryArrNames || '').split(',');
				
				let options = JSON.parse(JSON.stringify(optData));
				console.log('options',options);
				let partTags = [];
				if (names.length) {
					for (let i = 0; i < options.length; i++) {
						let item = { name: options[i].name, children: [] };
						for (let j = 0; j < options[i].children.length; j++) {
							for (let k = 0; k < options[i].children[j].children.length; k++) {
								if (names.indexOf(options[i].children[j].children[k].name) != -1) {
									item.children.push(options[i].children[j].children[k].name);
									break;
								}
							}
						}
						partTags.push(item);
					}
				}

				this.structures = { ...res.data, partTags };
				this.integrityFunc(10);
			});
		},

		initFloorData(res) {
			this.floorDoors = res.data.floorDoors || [];
			// this.fieldV = res.data.fieldV || {};
			if (res.data.floorNums) {
				this.floorNumsList = res.data.floorNums.split(',');
				
				if (
					this.floorNumsList.length > 0 &&
					!this.floorNumsList[this.floorNumsList.length - 1]
				) {
					// 移除最后一个元素
					this.floorNumsList.pop();
				}
				this.floorNumsOptions = this.floorNumsList.map((item) => {
					return {
						label: item,
						value: item,
					};
				});
				this.floorFormGroup.forEach((item) => {
					// 设置层站门下拉数据
					item.floorNums = this.floorNumsList;
					// 回显层站门数据
					switch (item.prop) {
					case 'tier':
						if (res.data.floorTier) {
							item.selectValue = [];
							(res.data.floorTier || []).forEach((v) => {
								if (v.isHas) item.selectValue.push(v.floorNum + '');
							});
							console.log(item.selectValue, 'item.selectValue-tier');
						}
						break;
					case 'stand':
						if (res.data.floorPlatforms) {
							item.selectValue = [];
							(res.data.floorPlatforms || []).forEach((v) => {
								if (v.isHas) item.selectValue.push(v.floorNum + '');
							});
							console.log(item.selectValue, 'item.selectValue-stand');
						}
						break;
					case 'door':
						if (res.data.floorDoors) {
							item.selectValue = [];
							(res.data.floorDoors || []).forEach((v) => {
								if (v.isFrontDoor) item.selectValue.push(`${v.floorNum}前`);
								if (v.isBackDoor) item.selectValue.push(`${v.floorNum}后`);
							});
						}
						break;
					}
				});
			}
		},
		// 获取保险公司列表
		getElevatorInsuranceList() {
			insurance({
				size: 100,
				current: 1
			}).then(({ data }) => {
				console.log('getElevatorInsuranceList', data);
				this.insuranceList = data.records || [];
			});
		},
		// 获取型号列表
		getBrandversionList() {
			if (!this.info.brandId) {
				uni.showToast({
					title: '请先选择品牌',
					icon: 'none',
				});
				return;
			}

			getBrandversionList({
				brandId: this.info.brandId,
			}).then((res) => {
				this.brandversions = res.data || [];
				this.$refs.brandversions.open();
			});
		},

		// 获取系列列表
		getBrandversionskuList() {
			if (!this.info.brandVId) {
				uni.showToast({
					title: '请先选择型号',
					icon: 'none',
				});
				return;
			}

			getBrandversionskuList({
				brandId: this.info.brandId,
				versionId: this.info.brandVId,
			}).then((res) => {
				this.brandVSkus = res.data || [];
				this.$refs.brandVSkus.open();
			});
		},

		openPhoneSelect() {
			if (this.phoneNums.length == 0) {
				uni.showToast({
					title: '暂无服务电话请通知客服后台添加',
					icon: 'none',
				});
				return;
			}
			this.phoneAct = this.info.wbPhone || 0;
			this.$refs.phoneNums.open();
			this.disableInput();
		},

		phoneNumsChange(res) {
			console.log('phoneNumsChange', res);
		},

		phoneNumsClose(res) {
			console.log('phoneNumsClose', res);
			this.$refs.phoneNums.close();
			if (res.index !== undefined) {
				this.phoneAct = res.index;
				this.info.wbPhone = this.phoneNums[res.index].phone;
			}

			this.activeInput();
		},
		// 获取维保服务电话
		getElevatorPhones() {
			getElevatorPhones({}).then((res) => {
				this.phoneNums = (res.data || []).map((item) => {
					return {
						...item,
						label: item.phoneDesc
							? `${item.phoneDesc} ${item.phone}`
							: item.phone,
					};
				});
			});
		},

		changeAttachmentList(res) {
			if (res && res.length > 0) {
				this.nameAttachmentList = [res[res.length - 1]];
				console.log(this.nameAttachmentList, 'this.nameAttachmentList');
			}
		},
		// 更新图片
		changeImgs(res, key) {
			console.log(key, res, 'changeImgs');
			if (res && res.length > 0) {
				if (key === 'fileListMark') {
					this.fileListMark = [res[res.length - 1]];
				} else {
					this.info[key] = [res[res.length - 1]];
					console.log(this.info[key], 'this.info[key]');
					console.log(this.info, 'info-changeImgs');
					if (key === 'wbPhoneImg' || key === 'wbExtUrl') {
						this.integrityFunc(2);
					}
					if (key === 'elevatorNumImg') {
						this.integrityFunc(7);
					}
					if (key === 'bxExtUrl') {
						this.integrityFunc(9);
					}
				}
			}
		},
		setHeight(n) {
			this.mheight = n;
		},
		formatNumber(n) {
			n = n.toString();

			return n[1] ? n : '0' + n;
		},
		disableInput() {
			this.inputDisable = true;
		},
		activeInput() {
			this.inputDisable = false;
		},
		changeMadeDate(res, key) {
			console.log(res);
			this.info[key] = res.detail.value;
		},
		// 驱动方式弹出框
		openDriveMode() {
			this.$refs.popup3.open();
			this.disableInput();
		},

		// 电梯用途弹出框
		openElevtorUse() {
			this.$refs.elevtorUse.open();
			this.typeSeleArrs = ['年审梯', '非年审梯'];
			this.disableInput();
		},
		// 启用时间弹出框
		openDateSelect(types) {
			this.timeType = types;
			this.$refs.startTime.open();
			this.disableInput();
			let nowYear = new Date().getFullYear();
			let nowMonth = this.formatNumber(new Date().getMonth() + 1);
			let nowYearIdx = this.yearList.findIndex((item) => item == nowYear);
			let monthIdx = this.monthList.findIndex((item) => item == nowMonth);
			let arr = [];
			this.dayList = [];
			let dayIdx = 0;
			let nowDay = 0;
			nowDay = dayjs().format('DD'); 
			if (nowDay < 10) {
				nowDay = nowDay.slice(1);
			}
			let end = new Date().getFullYear() + 10;
			this.yearList = this.getArr(1970, end);
			this.monthList = this.getArr(1, 12);
			let daysCount = dayjs(dayjs().format('YYYY/MM')).daysInMonth();
			this.dayList = Array.from(new Array(daysCount + 1).keys()).slice(1);
			this.allData = [this.yearList, this.monthList, this.dayList];

			if (this.info.azCheckBeginDate && types === 1) {// 启用时间
				arr = this.getMadeDate(this.info.azCheckBeginDate,true).split('-');
			}
			// if (!this.info.azCheckBeginDate && types === 1) {
			// 	this.monthList = this.getArr(1, new Date().getMonth() + 1, true);
			// }
			
			// if (arr && arr.length > 1 && nowYear == arr[0]) {
			// 	this.monthList = this.getArr(1, new Date().getMonth() + 1, true);
			// }

			if (types === 2 && this.info.bxCompanyEndDate) {// 保险时间
				arr = this.getMadeDate(this.info.bxCompanyEndDate,true).split('-');
			}

			if (arr && arr.length > 1) {
				let dateYearIdx = this.yearList.findIndex((item) => item == arr[0]);
				let datemonthIdx = this.monthList.findIndex((item) => item == arr[1]);
				let dateDayIdx = this.dayList.findIndex((item) => item == arr[2]);
				this.startTimeActive = [dateYearIdx, datemonthIdx,dateDayIdx];
				// this.startTimeActive = [dateYearIdx, datemonthIdx];
			} else {
				// this.startTimeActive = [nowYearIdx, monthIdx];
				dayIdx = this.dayList.findIndex((item) => item == Number(nowDay));
				this.startTimeActive = [nowYearIdx, monthIdx,dayIdx];
			}
			this.$forceUpdate();
		},
		// 启用时间select
		bindChange(arr) {
			if (arr && arr.length) {
				let curYear = new Date().getFullYear();
				let years = this.yearList[arr[0]];
				if (curYear == years) {
					this.monthList = this.getArr(1, new Date().getMonth() + 1, true);
				} else {
					this.monthList = this.getArr(1, 12, true);
				}
				this.$forceUpdate();
			}
		},
		// 关闭启用时间select
		maskClick() {
			this.yearList = this.getYears();
			this.monthList = this.getArr(1, 12);
			this.$forceUpdate();
		},
		nextCheckTime(val) {
			console.log(val);
			let date = new Date(val);
			let month = date.getMonth() + 1;
			let year = date.getFullYear() + 1;
			return year + '/' + (month >= 10 ? month : '0' + month);
		},
		feedback(i) {
			console.log(i);
		},
		// 正则
		resetPower(e) {
			let val = e.target.value;
			console.log(val, 'val的值');
			let reg = new RegExp(/^[0-9]*[1-9][0-9]*$/);
			// let reg='^[0-9]*[1-9][0-9]*$'
			// val = val.replace(reg, '');
			let first = val.indexOf('0');
			if (first == 0) {
				uni.showToast({
					title: '不能以0开头',
					icon: 'none',
				});
				val = val.slice(1, val.length);
			} else if (!reg.test(val)) {
				val = '';
				uni.showToast({
					title: '最多输入4位正整数',
					icon: 'none',
				});
			}
			this.$nextTick(() => {
				this.info.supportingPower = val;
			});
		},
		getMadeDate(val = '',type = false) {
			console.log(val, '-----', this.info.bxCompanyEndDate, 9999999999);
			if (!val) {
				return '';
			}
			let vals = val.replaceAll('-', '/');
			let date = new Date(vals);
			let year = date.getFullYear();
			let month = date.getMonth() + 1;
			if (type) {
				let days = dayjs(vals).format('DD');
				return year + '-' + (month >= 10 ? month : '0' + month) + '-' + days;
			}
			return year + '-' + (month >= 10 ? month : '0' + month);
		},
		// 检验速度
		getSpeed(e, key) {
			let val = e.target.value.replace(/(^\s*)|(\s*$)/g, '');
			console.log(val, 222);
			if (!val) {
				this.info.speed = '';
				return;
			}
			var reg = /[^\d.]/g;

			// 只能是数字和小数点，不能是其他输入
			val = val.replace(reg, '');
			// // 保证第一位只能是数字，不能是点
			val = val.replace(/^\./g, '');
			// // 小数只能出现1位
			val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.');
			// // 小数点后面保留2位
			// eslint-disable-next-line no-useless-escape
			val = val.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
			console.log(val, 333);
			this.$nextTick(() => {
				this.fieldV[key] = val;
			});
		},
		fetchBrand() {
			getBrand({}).then((res) => {
				this.brandList = res.data;
			});
		},
		getInfo() {
			uni.showLoading({
				title: '加载中',
			});
			elevtorDetail({
				elevatorId: this.elevatorId,
			}).then((res) => {
				uni.hideLoading();
				this.info = res.data || {};
				this.integrityObj.lw = this.info.lwIntact * 100 >= 100 ? 100 : this.info.lwIntact * 100;
				this.integrityObj.wb = this.info.wbIntact * 100 >= 100 ? 100 : this.info.wbIntact * 100;
				this.integrityObj.bx = this.info.bxIntact * 100 >= 100 ? 100 : this.info.bxIntact * 100;
				this.integrityObj.sc = this.info.sbJsIntact * 100 >= 100 ? 100 : this.info.sbJsIntact * 100;
				this.integrityObj.sb = this.info.sbZcIntact * 100 >= 100 ? 100 : this.info.sbZcIntact * 100;
				this.integrityObj.cc = this.info.ccIntact * 100 >= 100 ? 100 : this.info.ccIntact * 100;
				this.integrityObj.sy = this.info.syIntact * 100 >= 100 ? 100 : this.info.syIntact * 100;
				this.integrityObj.az = this.info.azIntact * 100 >= 100 ? 100 : this.info.azIntact * 100;
				this.integrityObj.pt = this.info.twyIntact * 100 >= 100 ? 100 : this.info.twyIntact * 100;
				this.integrityObj.jg = this.info.jgIntact * 100 >= 100 ? 100 : this.info.jgIntact * 100;
				this.info.bxCompanyName = (this.insuranceList.find((item) => item.id === this.info.bxCompanyId) || {}).name;
				this.$refs.percentage.start();
				if (
					this.info.nameAttachmentList &&
					this.info.nameAttachmentList.length
				) {
					// 电梯铭牌附件
					this.info.nameAttachmentTime =
						this.info.nameAttachmentList[0].createTime;
					let arr = [];
					let list = this.info.nameAttachmentList;
					for (let i = 0; i < list.length; i++) {
						if (list[i].attachment) {
							arr.push(JSON.parse(list[i].attachment));
						}
					}
					this.nameAttachmentList = arr;
				}
				let arr = [];
				if (this.info.certificateLists && this.info.certificateLists.length) {
					// 电梯铭牌附件
					this.info.certificateDate = this.info.certificateLists[0].createTime;
					let list = this.info.certificateLists;
					for (let i = 0; i < list.length; i++) {
						if (list[i].attachment) {
							arr.push({
								...JSON.parse(list[i].attachment),
								...list[i],
							});
						}
					}
				}
				this.fileListMark = arr;
				if (res.data.fieldV) {
					this.fieldV = res.data.fieldV;
				}
				this.initFloorData(res);
				getDriveMode().then((res) => {
					this.driveMode = res.data;
					console.log(res, 'drive');
					let map = {};
					let obj = {
						3110: 6,
						3420: 6,
						3410: 6,
						3130: 6,
						3120: 6,
						3220: 9,
						3430: 6,
						3320: 5,
						3210: 9,
						3310: 5,
					};
					for (let pro in obj) {
						this.driveMode.forEach((item, index) => {
							if (item.code == pro) {
								item.nums = obj[pro];
							}
						});
					}
					for (let i = 0; i < this.driveMode.length; i++) {
						map[this.driveMode[i].id] = this.driveMode[i];
					}
					this.elevatorUseTypeListMap = map;
					let code = '';
					if (this.info.elevatorUseType) {
						code =
							this.elevatorUseTypeListMap[this.info.elevatorUseType].code || '';
					}
					for (let data of res.data) {
						this.driveModeList.push(data.name);
					}
					this.getFieldSelect(
						'controlMode',
						code,
						this.fieldV.driverMode || ''
					);
					// 查询
					this.getFieldSelect('jackingForm', '');
					this.getFieldSelect('antiExplosionLevel', '');
					if (this.typeKeys['driverMode']) {
						// 控制方式列表
						this.getFieldSelect('driverMode', '');
					}
				});
				this.brandId = !this.info.brandId ? '' : this.info.brandId;
			});
		},
		getArr(start, end, makeUpZaro) {
			makeUpZaro || false;
			// console.log(Array.from(new Array(end + 1).keys()),333);
			let arr = Array.from(new Array(end + 1).keys()).slice(start);
			let newArr = arr.map((item) => {
				return item > 9 ? item : '0' + item;
			});
			// console.log(newArr,"新");
			return makeUpZaro ? newArr : arr;
		},
		// 获取今年启用时间的年份
		getYears(type = 1) {
			let now = new Date().getFullYear();
			let end = Number(now);
			// let start = Number(now) - 50;
			return this.getArr(1970, end);
		},
		close() {
			// console.log(1223);
			this.closeFlag = false;
		},
		// 选择保险公司
		showInsurance() {
			this.$refs.popupIn.open();
			this.disableInput();

			const { bxCompanyId } = this.info;
			console.log(this.insuranceList);
			const index = this.insuranceList.findIndex((item) => {
				return item.id === bxCompanyId;
			});
			console.log(index, 'index的之后');
			if (index == -1) {
				this.inActive = [0];
			} else {
				this.inActive = [index];
			}
			console.log(this.inActive);
		},
		// 选择品牌
		showBrand() {
			this.$refs.popup.open();
			this.disableInput();
			const { brandId } = this.info;
			console.log(this.brandList, brandId);
			const index = this.brandList.findIndex((item) => {
				// console.log(item,'item的值')
				return item.id === brandId;
			});
			console.log(index, 'index的之后');
			if (index == -1) {
				this.brandActive = [0];
			} else {
				this.brandActive = [index];
			}
			console.log(this.brandActive);
		},
		// 选择层站门
		showDoor() {
			this.$refs.popup2.open();
			this.disableInput();
			const { stand, door, floorHigh } = this.info;
			if (stand && door && floorHigh) {
				this.floorActive = [
					Number(floorHigh) - 2,
					Number(stand) - 2,
					Number(door) - 2,
				];
				console.log(this.floorActive, 'this.floorActive的值');
			}
		},
		// 选择层站门
		showFloorSelect(item) {
			if (this.floorDoors.length == 0) {
				uni.showModal({
					title: '提示',
					content: '暂无楼层信息\n请前往楼信息页面添加',
					cancelColor: '#999999',
					confirmColor: '#0091ff',
					confirmText: '立即前往',
					success: (res) => {
						if (res.confirm) {
							uni.navigateTo({
								url: `/subpages/buildingInfos/index?buildingId=${this.info.buildingId}`,
							});
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					},
				});
				return;
			}
			this.$refs.floorRef.open();
			this.disableInput();
			// this.floorItem = {
			//   prop: 'floorHigh',
			//   label: '',
			//   selectValue: [],
			// }
			this.floorItem = {
				...item,
			};
		},
		// 型号
		handleBvClose(res) {
			this.activeInput();
			this.$refs.brandversions.close();
			if (res.index !== undefined) {
				this.info.brandVId = this.brandversions[res.index].id;
				this.info.brandVName = this.brandversions[res.index].name;
			}
		},

		// 系列
		brandVSkuClose(res) {
			this.activeInput();
			this.$refs.brandVSkus.close();
			if (res.index !== undefined) {
				this.info.brandVSkuName = this.brandVSkus[res.index].name;
				this.info.brandVSkuId = this.brandVSkus[res.index].id;
			}
		},

		// 关闭保险公司
		handleCloseIn(res) {
			this.activeInput();
			this.$refs.popupIn.close();
			console.log(res);
			// 如果是品牌
			if (res.type === 1) {
				this.info.bxCompanyName = this.insuranceList[res.index].name;
				this.info.bxCompanyId = this.insuranceList[res.index].id;
			}

			this.integrityFunc(9);
		},
		// 关闭品牌
		handleClose(res) {
			this.activeInput();
			this.$refs.popup.close();
			console.log(res);
			// 如果是品牌
			if (res.type === 1) {
				this.info.brandName = this.brandList[res.index].brandName;
				this.info.brandId = this.brandList[res.index].id;
				this.info.brandVId = '';
				this.info.brandVName = '';
				this.info.brandVSkuName = '';
				this.info.brandVSkuId = '';
				console.log(this.info.brandName, this.brandId);
			}

			this.integrityFunc(4);
		},
		// 关闭层站门
		handleCloseDoor(res) {
			this.activeInput();
			this.$refs.popup2.close();
			this.activeInput();
			// 层站门
			this.info.floorHigh = this.doorList[res[0]];
			this.info.stand = this.doorList[res[1]];
			this.info.door = this.doorList[res[2]];
			this.floorActive = res;
			console.log(this.info.floorHigh, this.info.stand, this.info.door);
		},

		// 选择设备品种
		handleCloseDriveMode(res) {
			this.activeInput();
			// driveModeName
			console.log('96969', this.driveMode[res.index]);
			this.$refs.popup3.close();
			this.info.elevatorUseType = this.driveMode[res.index].id;
			this.info.driveModeName = this.driveMode[res.index].name;
			const code = this.elevatorUseTypeListMap[this.info.elevatorUseType].code;
			this.fieldV.driverMode = '';
			this.fieldV.controlMode = '';
			// 查询控制方式列表
			this.getFieldSelect('controlMode', code);
			if (this.typeKeys['driverMode']) {
				this.getFieldSelect('driverMode', '');
			} else {
				this.selectItem.driverModeList = [];
			}
			this.integrityFunc(1);
			this.integrityFunc(2);
			this.integrityFunc(3);
			this.integrityFunc(9);
		},
		// 选择电梯用途
		handleCloseElevtorUse(res) {
			this.activeInput();
			this.$refs.elevtorUse.close();
			console.log(res);
			this.useType = res.index;
			this.info.useType = res.index;

			this.integrityFunc(1);
			this.integrityFunc(2);
			this.integrityFunc(3);
			this.integrityFunc(9);
		},
		// 关闭对话框,选择了启用时间
		handleCloseDate(res) {
			this.activeInput();
			console.log('关闭对话框,选择了启用时间',res);

			if (res && res.length > 1) {
				if (this.timeType === 1) {
					this.info.azCheckBeginDate =  `${this.yearList[res[0]]}-${this.monthList[res[1]]}-${this.dayList[res[2]]} 00:00:00`;
				}
				if (this.timeType === 2) {
					this.info.bxCompanyEndDate = `${this.yearList[res[0]]}-${this.monthList[res[1]]}-${this.dayList[res[2]]} 00:00:00`;
				}
				this.$refs.startTime.close();
			}
			if (this.info.azCheckBeginDate) {
				this.integrityFunc(6);
			}
			if (this.info.bxCompanyEndDate) {
				this.integrityFunc(9);
			}
			this.timeType = 0;
		},
		bindPickerChange(e) {
			console.log(e.detail.value, 'brandList');
			this.info.brand = this.brandList[e.detail.value];
		},
		changeInput(item) {
			// 如果是设备代码20位,自动请求后端获取驱动方式
			if (item.key === 'code') {
				if (this.info.code.length === 3) {
					console.log('这里发送请求');
				}
			}
		},
		strTest(str) {
			// 判断字符串是否为数字和字母组合
			var zg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/;
			if (!zg.test(str)) {
				return false;
			} else {
				return true;
			}
		},
		// 保存
		handleSave() {
			console.log(this.floorFormGroup, 'this.floorFormGroup');
			const str = this.validateForm();
			
			let arrStr = ['顶升形式'];
			let nums = 1;
			if (this.fieldV.driverMode != '3' && arrStr.includes(str)) {
				nums = 2;
			}
			if (str && nums === 1) {
				uni.showToast({
					title: '请输入' + str,
					icon: 'none',
				});
				return;
			}
			let info = JSON.parse(JSON.stringify(this.info));
			// console.log(this.info.brandId);
			if (this.phoneNums.length == 0) {
				uni.showToast({
					title: '暂无服务电话请通知客服后台添加',
					icon: 'none',
				});
				return;
			}
			if (!this.info.wbPhone) {
				uni.showToast({
					title: '请选择服务电话',
					icon: 'none',
				});
				return;
			}
			if (info.privateNumIsFull) {
				// if (this.strTest(info.privateNumIsFull) == false) {
				// 	uni.showToast({
				// 		title: '设备代码只能包含数字和字母',
				// 		icon: 'none'
				// 	});
				// 	return;
				// }

				if (info.privateNumIsFull.length > 20) {
					uni.showToast({
						title: '设备代码不能超过20位',
						icon: 'none',
					});
					return;
				}
			} else {
				info.privateNumIsFull = null;
			}
			// if (info.azCheckBeginDate) {
			// 	if (info.azCheckBeginDate.length <= 8) {
			// 		info.azCheckBeginDate = info.azCheckBeginDate.replace(/-/g, '');
			// 	} else {
			// 		info.azCheckBeginDate = this.getMadeDate(info.azCheckBeginDate).replace(/-/g, '');
			// 	}
			// 	// delete info.startDate
			// }
			if (info.factoryDate && info.factoryDate.indexOf(':00') == -1) {
				info.factoryDate = info.factoryDate + ' 00:00:00';
			}
			if (info.madeDate && info.madeDate.indexOf(':00') == -1) {
				info.madeDate = info.madeDate + ' 00:00:00';
			}

			info.nameAttachmentList = this.nameAttachmentList.map((item) => {
				return {
					attachment: JSON.stringify(item),
					status: 3,
					elevatorId: this.elevatorId,
				};
			});
			if (this.fileListMark) {
				info.certificateLists = this.fileListMark.map((item) => {
					let param = {
						attachment: item['attachment']
							? item['attachment']
							: JSON.stringify(item),
						status: 2,
						elevatorId: this.elevatorId,
					};
					if (item['id']) param.id = item['id'];
					return param;
				});
			}
			info.floorHigh = this.fieldV.tier;
			info.door = this.fieldV.door;
			info.stand = this.fieldV.stand;
			info.fieldV = this.fieldV;
			info.fieldV.elevatorId = this.info.id;
			this.floorFormGroup.forEach((item) => {
				console.log(item, 'floorFormGroup-item');
				switch (item.prop) {
				case 'tier':
					(info.floorTier || []).forEach((v) => {
						v.isHas = item.selectValue.includes(v.floorNum);
					});
					break;
				case 'stand':
					(info.floorPlatforms || []).forEach((v) => {
						v.isHas = item.selectValue.includes(v.floorNum);
					});
					break;
				case 'door':
					(info.floorDoors || []).forEach((v) => {
						v.isFrontDoor = item.selectValue.includes(`${v.floorNum}前`);
						v.isBackDoor = item.selectValue.includes(`${v.floorNum}后`);
					});
					break;

				default:
					break;
				}
			});
			console.log('this.nameAttachmentList',info);
			console.log('this.6666666666', this.floorFormGroup);

			if (!this.disabled) {
				this.disabled = true;
				uni.showLoading({
					title: '更新数据中',
					mask: true,
				});
				console.log(info, 'save-info');

				// return
				update(
					this.elevatorId,
					info.brandId
						? {
							...info,
							brandId: info.brandId,
						}
						: info
				).then((res) => {
					console.log(res, '更新');
					if (res) {
						setTimeout(() => {
							uni.showToast({
								title: '更新成功',
								icon: 'none',
							});
							this.disabled = false;
						}, 500);
						this.getInfo();
					}
				});
				setTimeout(() => {
					this.disabled = false;
				}, 3000);
			} else {
				setTimeout(() => {
					uni.showToast({
						title: '正在更新，请稍后',
						icon: 'none',
					});
				}, 500);
			}
		},
		// 判断输入是否20位
		changePrivateNum(val) {
			// console.log(val.target.value)
			let res = val.target.value;
			var patt1 = new RegExp('^[A-Za-z0-9]+$');
			console.log(res);
			console.log(patt1.test(res));
			if (patt1.test(res)) {
				this.info.privateNumIsFull = true;
			} else {
				this.info.privateNumIsFull = false;
			}
			// if (res.length === 20) {
			// 	this.info.privateNumIsFull = true
			// }
		},
		handleSelectShow(key) {
			this.selectItem.key = key;
			this.disableInput();
			this.selectItem.list = this.selectItem[key + 'List'] || [];
			console.log(this.selectItem, key);
			const { controlMode } = this.info;
			const { jackingForm } = this.info;
			const { driverMode } = this.info;
			switch (key) {
			case 'controlMode':
				this.selectItem.title = '控制方式';

				this.selectItem.active =
						this.selectItem.list.findIndex((v) => v.dictKey === controlMode) > 0
							? [
								this.selectItem.list.findIndex(
									(v) => v.dictKey === controlMode
								),
							]
							: [0];
				console.log(this.selectItem.active, 'this.selectItem.active');
				break;
			case 'jackingForm':
				this.selectItem.title = '顶升形式';

				this.selectItem.active = jackingForm;
				this.selectItem.active =
						this.selectItem.list.findIndex((v) => v.dictKey === jackingForm) > 0
							? [
								this.selectItem.list.findIndex(
									(v) => v.dictKey === jackingForm
								),
							]
							: [0];
				break;
			case 'driverMode':
				this.selectItem.title = '驱动方式';

				this.selectItem.active =
						this.selectItem.list.findIndex((v) => v.dictKey === driverMode) > 0
							? [
								this.selectItem.list.findIndex(
									(v) => v.dictKey === driverMode
								),
							]
							: [0];
				break;
			}
			this.$refs.selectRef.open();
		},
		handleSelectClose(res) {
			console.log(res, 'handleSelectClose');
			// debugger
			this.activeInput();
			if (res.index === undefined) {
				return;
			}
			const item = this.selectItem[this.selectItem.key + 'List'][res.index];
			this.fieldV[this.selectItem.key] = item.dictKey;
			console.log(this.fieldV,item, 'fieldV');
			console.log(this.selectItem, 'selectItem');
			if (this.selectItem.key === 'driverMode') {
				this.getFieldSelect(
					'controlMode',
					this.elevatorUseTypeListMap[this.info.elevatorUseType].code,
					this.fieldV[this.selectItem.key]
				);
			}
			this.$refs.selectRef.close();
			this.integrityFunc(3);
		},
		handleFloorSelectChange(e) {
			console.log(e, 'handleFloorSelectChange');
		},
		handleFloorClose(value) {
			this.floorFormGroup.forEach((item) => {
				if (item.prop === this.floorItem.prop) {
					item.selectValue = [...value];
					this.fieldV[item.prop] = value.length;
				}
			});
			this.floorItem = {
				prop: 'tier',
				label: '',
				selectValue: [],
			};
			console.log(this.info, 'this.info');
			this.$refs.floorRef.close();
			console.log(value,this.floorFormGroup, 'handleFloorSelectChange');
			this.integrityFunc(3);
		},
		// 下拉框字典
		getFieldSelect(code, driverModeCode, driverModeKey) {
			return new Promise((resolve) => {
				console.log(
					{
						code,
						driverModeCode,
						driverModeKey,
					},
					'getFieldSelect'
				);
				getFieldSelect({
					code,
					driverModeCode,
					driverModeKey,
				}).then((res) => {
					let list = res.data;
					if (code == 'elevator_label') {
						// 电梯标签
						let obj = {};
						for (let i = 0; i < list.length; i++) {
							if (list[i].dictKey.indexOf('_') == -1) {
								obj[list[i].dictKey] = {
									name: list[i].dictValue,
									children: [],
									key: list[i].dictKey,
								};
							}
						}
						let arr = [];
						for (let i = 0; i < list.length; i++) {
							if (list[i].dictKey.indexOf('_') != -1) {
								let keyd = list[i].dictKey.split('_')[0];
								if (obj[keyd]) {
									obj[keyd].children.push(list[i]);
								}
							}
						}
						for (const key in obj) {
							arr.push(obj[key]);
						}
						console.log('电梯标签', list, arr);
						// this.checks = arr;
					} else if (code === 'driverMode') {
						let arr = [];
						for (let i = 0; i < list.length; i++) {
							list[i].name = list[i].dictValue;
							const item =
								this.elevatorUseTypeListMap[this.info.elevatorUseType] || {};
							const codeed = item.code;
							if (codeed === '3420') {
								if (list[i].dictKey != 1) {
									// 非曳引与强制驱动
									arr.push(list[i]);
								}
							} else {
								if (list[i].dictKey != 2) {
									// 非曳引驱动
									arr.push(list[i]);
								}
							}
						}
						this.selectItem[code + 'List'] = arr;
						console.log(this.selectItem[code + 'List'], 'getFieldSelect1');
						if (!this.fieldV.driverMode && arr.length) {
							this.fieldV.driverMode = arr[0].dictKey;
							// 查询控制方式列表
							this.getFieldSelect(
								'controlMode',
								this.elevatorUseTypeListMap[this.info.elevatorUseType].code,
								arr[0].dictKey
							);
						}
						console.log(code + 'List', this.selectItem, '2');
					} else {
						res.data.forEach((v) => {
							v.name = v.dictValue;
						});
						console.log(res.data, 'res.data');
						this.selectItem[code + 'List'] = res.data;
						console.log(code + 'List', this.selectItem, '3');
					}
					resolve();
				});
			});
		},
		// 验证
		validateForm() {
			const validFormList = this.formList.reduce((acc, item) => {
				acc[item.key] = item.name;
				return acc;
			}, {});
			console.log(validFormList, 'validFormList');
			const infoValidObj = {
				elevatorUseType: '设备品种',
				brandId: '品牌',
				useType: '电梯年检类型',
				// privateNum: '设备代码',
				// equipmentRegisterNumber: '登记证编码',
				// registerNumber: '单位内编码',
				// certificationBody: '检验机构',
				// registrationAuthority: '登记机关',
			};
			let validObj = {
				...validFormList,
				tier: '层',
				stand: '站',
				door: '门',
				controlMode: '控制方式',
				jackingForm: '顶升形式',
				driverMode: '驱动方式',
				ratedSpeedUp: '额定上行速度',
				ratedSpeedDown: '额定下行速度',
				ratedWeight: '额定载重量',
				oilCylinderNum: '油缸数量',
				antiExplosionMark: '整机防爆标志',
				antiExplosionLevel: '区域防爆等级',
				securityGuardName: '安全管理员',
			};
			console.log(validObj, 'validObj');
			for (const key in infoValidObj) {
				if (!this.info[key] && this.info[key] !== 0) {
					return infoValidObj[key];
				}
			}
			for (const key in validObj) {
				if (!this.fieldV[key] && this.fieldV[key] !== 0 && this.typeKeys[key]) {
					return validObj[key];
				}
			}
			
			return false;
		},
		// 各分类完整度计算
		integrityFunc(num) {
			if (num === 1) {// 类型与位置
				let n_Len = 2;
				let n2 = this.info.useType || this.info.useType === 0 ? 1 : 0;
				let n3 = this.info.driveModeName ? 1 : 0;
				let r1 = n2 + n3;
				let r2 = Math.ceil((r1 / n_Len) * 100);
				this.integrityObj.lw = r2;
			}
			if (num === 2) {// 维保信息
				let c_len = 2, c1 = 0, c2 = 0, c3 = 0;
				c1 = this.info.wbPhone ? 1 : 0;
				c2 = this.wbPhoneImg.length ? 1 : 0;
				if (this.info.useType === 0) {
					c3 = this.wbExtUrl.length ? 1 : 0;
					c_len = 3;
				}
				let c4 = c1 + c2 + c3;
				let c5 = Math.ceil((c4 / c_len) * 100);
				this.integrityObj.wb = c5;
			}
			if (num === 3) {// 设备技术参数
				let numr = this.elevatorUseTypeListMap[this.info.elevatorUseType].nums;
				let valLen = 0;
				let objr = {
					tier: this.fieldV.tier,
					stand: this.fieldV.stand,
					door: this.fieldV.door,
					ratedSpeed: this.fieldV.ratedSpeed,
					ratedWeight: this.fieldV.ratedWeight,
					controlMode: this.fieldV.controlMode,
				};
				if (numr === 5) {
					objr = {
						nominalSpeed: this.fieldV.nominalSpeed,
						nominalWidth: this.fieldV.nominalWidth,
						inclineAngle: this.fieldV.inclineAngle,
						transportCapacity: this.fieldV.transportCapacity,
						zoneLength: this.fieldV.zoneLength,

					};
					if (this.elevatorUseTypeListMap[this.info.elevatorUseType].code == 3310) {
						delete objr.zoneLength;
						objr.promoteHeight = this.fieldV.promoteHeight;
					}
				}
				if (numr === 9 || this.fieldV.driverMode == 3) {
					delete objr.ratedSpeed;
					objr.ratedSpeedDown = this.fieldV.ratedSpeedDown;
					objr.ratedSpeedUp = this.fieldV.ratedSpeedUp;
					objr.oilCylinderNum = this.fieldV.oilCylinderNum;
					objr.jackingForm = this.fieldV.jackingForm;
				}
				valLen = Object.values(objr).filter(v => {
					if (v) {
						return v;
					}
				}).length;
				if (numr !== 5) {
					numr += this.floorFormGroup.length;
					valLen += this.floorFormGroup.filter((item) => {
						if (item.selectValue && item.selectValue.length) {
							return item.selectValue;
						}
					}).length;
				}
				if (this.fieldV.driverMode == 3) {
					numr += 3;
				}
				console.log(valLen, numr, this.floorFormGroup, 'valLen');
				let a1 = Math.ceil((valLen / numr) * 100);
				this.integrityObj.sc = a1;
			}

			if (num === 4) {// 出厂信息
				let f_len = 1;
				let g1 = this.info.brandName ? 1 : 0;
				let g2 = Math.ceil((g1 / f_len) * 100);
				this.integrityObj.cc = g2;
			}
			if (num === 5) {// 使用信息
				let q_len = 1;
				let q1 = this.info.securityGuardName ? 1 : 0;
				// let q2 = this.formData.buildingAddress ? 1 : 0;
				let q3 = q1;
				let q4 = Math.ceil((q3 / q_len) * 100);
				this.integrityObj.sy = q4;
			}
			if (num === 6) {// 安装信息
				let b_len = 1;
				let b1 = this.info.azCheckBeginDate ? 1 : 0;
				let b2 = Math.ceil((b1 / b_len) * 100);
				this.integrityObj.az = b2;
			}
			if (num === 7) {// 梯无忧平台信息
				let c1 = this.info.elevatorNumImg.length ? 1 : 0;
				let c2 = Math.ceil((c1 / 1) * 100);
				this.integrityObj.pt = c2;
			}

			if (num === 8 && this.info.useType === 0) {// 设备注册信息
				let t_len = 4;
				let t1 = this.info.privateNum ? 1 : 0;
				let t2 = this.info.equipmentRegisterNumber ? 1 : 0;
				let t3 = this.info.registerNumber ? 1 : 0;
				let t4 = this.fileListMark.length ? 1 : 0;
				let t5 = t1 + t2 + t3 + t4;
				let t6 = Math.ceil((t5 / t_len) * 100);
				this.integrityObj.sb = t6;
			}
			if (num === 9 && this.info.useType === 0) {// 保险信息
				let p_len = 3;
				let p1 = this.info.bxCompanyId ? 1 : 0;
				let p2 = this.info.bxCompanyEndDate ? 1 : 0;
				let p4 = this.info.bxExtUrl?.length ? 1 : 0;
				let p5 = p1 + p2 + p4;
				let p6 = Math.ceil((p5 / p_len) * 100);
				this.integrityObj.bx = p6;
			}
			if (num === 10 && this.info.useType === 0) {// 电梯结构类型
				let j_len = 1;
				let j1 = this.structures.partTags.length ? 1 : 0;
				let j6 = Math.ceil((j1 / j_len) * 100);
				this.integrityObj.jg = j6;
			}

			this.$forceUpdate();
		},
	},
};
</script>
<style></style>
<style lang="scss">
page {
	//height: 100%;
	background-color: #f3f6f8;
}

uni-picker .uni-picker-action.uni-picker-action-confirm {
	color: #57dbd0 !important;
}

.elevtor-info {
	font-size: 28rpx;
	background-color: #f3f6f8;
	position: relative;

	// overflow: visible;
	// height: calc(100vh - 84rpx);
	//overflow-y: auto;
	//overflow-x: hidden;
	.isElevatorId {
		position: fixed;
		z-index: 3000;
		width: 100%;
	}

	.tips {
		color: #ff7505;

		.tips_text {
			display: flex;
			align-items: center;
		}

		display: flex;
		padding: 0 20rpx;
		justify-content: space-between;
		background: #fffadf;
		height: 80rpx;
		align-items: center;

		image {
			width: 32rpx;
			height: 32rpx;
			margin-right: 8rpx;
		}

		.close {
			padding: 30rpx 0 30rpx 30rpx;
		}
	}

	.content {
		display: flex;
		justify-content: center;
		// height: 1082rpx;
		flex-direction: column;
		align-items: center;
		padding-bottom: 40rpx;

		&-header {
			width: 710rpx;
			margin-bottom: 28rpx;

			&-title {
				width: 414rpx;
				height: 58rpx;
				font-size: 42rpx;
				font-family: PingFangSC, PingFangSC-Semibold;
				font-weight: 600;
				text-align: center;
				color: #333333;
				line-height: 58rpx;
				text-align: left;
				margin: 32rpx 0 0 0;
				height: fit-content;
				width: fit-content;
			}

			&-address {
				width: fit-content;
				height: 34rpx;
				font-size: 24rpx;
				font-family: PingFangSC, PingFangSC-Regular;
				font-weight: 400;
				text-align: left;
				color: #999999;
				line-height: 34rpx;
			}
		}

		.title {
			display: flex;
			height: 110rpx;

			view {
				display: flex;
				flex: 1;
				justify-content: center;
				align-items: center;
			}
		}

		.content-items {
			width: 710rpx;
			margin: 0 auto;

			.tit_progress {
				display: flex;
				align-items: center;
				margin: 20rpx 0 20rpx 0;

				.tit_Left {
					width: 280rpx;
					display: flex;
					align-items: center;

					.tit_text {
						height: 24rpx;
						width: 6rpx;
						display: block;
						background: #333;
						margin-right: 12rpx;
					}
				}

				.progress {
					flex: 1;
					display: flex;
					align-items: center;
					font-size: 24rpx;
					margin-right: 10px;

					.progress_item {
						display: flex;
						align-items: center;
						width: 130rpx;

						.progress_empty {
							margin-right: 8rpx;
							width: 28rpx;
							height: 28rpx;
							font-size: 20rpx;
							color: #0091ff;
							display: block;
							border: 2rpx solid #0091ff;
							border-radius: 50%;
							line-height: 28rpx;
							text-align: center;
						}
					}

					.progress_item2 {
						width: 300rpx;
					}
				}
			}
		}

		.form-content {
			width: 710rpx;
			box-sizing: border-box;
			background: #fff;
			margin: 0rpx 0 20rpx 0;
			padding: 0 20rpx;
			border-radius: 8rpx;
			display: flex;
			flex-direction: column;
			.imags-item {
				border-bottom: 2rpx solid #e9e9e9;
				padding: 20rpx 0 10rpx 0;

				&-head {
					padding-bottom: 8rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;

					.left {
						font-size: 28rpx;
						color: #999;
						display: flex;
						align-items: center;
						position: relative;
					}

					.right {
						display: flex;
						flex: 1;
						align-items: center;
						justify-content: flex-end;
					}
				}
			}

			.form-item {
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-bottom: 2rpx solid #e9e9e9;
				position: relative;

				.unit {
					margin-left: 4rpx;
				}

				.left {
					font-size: 28rpx;
					color: #999;
					width: 200rpx;
					display: flex;
					align-items: center;
					z-index: 2;
					position: relative;

					image {
						width: 28rpx;
						height: 28rpx;
						margin-left: 10rpx;
					}
				}

				.onlynum {
					width: 250rpx;
				}

				.required::after {
					content: "*";
					display: inline-block;
					color: #e02020;
					font-size: 28rpx;
				}

				// .p_empty::after {
				// 	content: "完";
				// 	margin-left: 22rpx;
				// 	width: 28rpx;
				// 	height: 28rpx;
				// 	color: #0091ff;
				// 	display: inline-block;
				// 	border: 2rpx solid #0091ff;
				// 	border-radius: 50%;
				// 	line-height: 28rpx;
				// 	text-align: center;
				// 	position: absolute;
				// 	right: 30rpx;
				// 	top: 4rpx;
				// }

				.left-col {
					flex-direction: column;
					align-items: flex-start;

					.desc {
						font-size: 24rpx;
					}
				}

				.right {
					min-height: 118rpx;
					display: flex;
					flex: 1;
					align-items: center;
					justify-content: flex-end;
					color: #333333;
					font-weight: normal;
					z-index: 2;

					&>view:nth-child(1) {
						display: flex;
						height: 100%;
						align-items: center;
						word-break: break-all;
						text-align: right;
						// color: #333;
					}

					&>input {
						text-align: right;
						width: 100%;
					}

					&>text {
						color: #999;
					}
				}
			}
			.border-hide{
				border: none !important;
			}

			picker {
				.form-item {
					height: 118rpx;
				}
			}

			&>.form-item:nth-last-child(1) {
				border: none !important;
			}

			.relation-other{
				width:100%;
				height: 70rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				border-radius: 4px;
				background: #F5FBFF;
				color: #0091FF;
				font-size: 28rpx;
				font-weight: bold;
				margin-bottom: 20rpx;
			}

			.part-tags {
				width: calc(100% - 16px);
				display: flex;
				flex-direction: column;
				padding: 8px;
				border-radius: 4px;
				background: #F6F7FA;
				margin-bottom: 14rpx;

				&-type {
					width: 100%;

					.ptt-name {
						color: #999999;
						font-style: 24rpx;
						margin-bottom: 8px;
					}

					.ptt-list {
						width: 100%;
						display: flex;
						flex-wrap: wrap;

						.tag {
							font-size: 28rpx;
							color: 666;
							padding: 2px 4px;
							border: 1px solid #CCCCCC;
							border-radius: 4px;
							margin-right: 16rpx;
							margin-bottom: 16rpx;
						}
					}
				}
			}

		}

		.p_empty {
			width: 28rpx;
			height: 28rpx;
			color: #0091ff;
			display: inline-block;
			border: 2rpx solid #0091ff;
			border-radius: 50%;
			line-height: 28rpx;
			text-align: center;
			font-size: 20rpx;
			position: absolute;
			right: 40rpx;
			top: 4rpx;
		}

		.bg-empty {
			background-color: #FFFADF;
			height: 40rpx;
			position: absolute;
			top: 42rpx;
			width: 670rpx;
			z-index: 1;
		}

		.holder {
			color: #ccc;
		}

		.noBorder {
			border: none !important;
		}
	}

	.save {
		background-color: #fff;
		padding: 14rpx;
		width: 100%;
		box-sizing: border-box;
		position: fixed;
		bottom: 0rpx;
		z-index: 99;

		/* #ifdef H5 */
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
		/* #endif */

		view {
			height: 70rpx;
			background: #0091ff;
			border-radius: 8rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #fff;
		}
	}
}
</style>
